<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>登录</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <style>
        .box {
            width: 200px;
            display:block;
            text-align: center;
            margin: 100px auto 0;
        }
        input{
            margin: 5px 0px;
        }
        button{
            display: inline-block;
            margin: 5px 10px;
        }
    </style>
</head>
<body>
<div class="box">
    <p>
        登录
    </p>
<form action="#" th:action="@{/login}" method="post">
    <input type="text" name="name" placeholder="账号" />
    <input type="password" name="password" placeholder="密码" />
    <button type="submit">登陆</button>
    <button id="register" type="button">注册</button>
</form>
</div>
<script>
    document.getElementById('register').addEventListener('click', function() {
        window.location.href =  "/register";
    });
</script>
<script th:inline="javascript">
        var error = [[${error}]];
        if (error) {
        alert(error);
    }
</script>
</body>
</html>